const fs = require('fs');
const path = require('path');
let express = require('express')
let app = express()
let Vue = require('vue')

let VueServerRenderer = require('vue-server-renderer')

let template = fs.readFileSync(path.join(__dirname, './index.html'), 'utf8')

// 穿件Vue实例
let vm = new Vue({
  template: '<div>hello3 word</div>'
})

let render = VueServerRenderer.createRenderer({
  template
})

app.get('/', (req, res)=>{
  render.renderToString(vm, (err, html)=>{
    res.end(html)
  })
})


app.listen(3000)